<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="t" %>

<t:body title="Редактивование группы">
	<c:choose>
		<c:when test="${group.id ne -1}">
		   	<c:url value="/group/${group.id}/edit" var="url"/>
		</c:when>
		<c:otherwise>
		   	<c:url value="/group/new" var="url"/>
		</c:otherwise>
	</c:choose>
	    <h2>Создание группы</h2>
	   	<div class="form_block">
		<form:form modelAttribute="group" onsubmit="select_all();" action="${url}">
	   		<t:input name="Название" path="name">
	   			<form:input path="name" size="30" maxlength="30"/>
	   		</t:input>
	   		
	        <t:input name="Год" path="year">
	   			<form:input path="year" size="30" maxlength="30"/>
	   		</t:input>
	   		
	        <t:input name="Студенты" path="students">
	   			<form:select path="students" items="${group.students}" itemLabel="fi" itemValue="id" size="5" id="inUsers" multiple="multiple" cssClass="stud_in_select"/>
	       		<br/><select id="outUsers" multiple="multiple" class="stud_out_select"/>
	       			<c:forEach items="${outUsers}" var="user">
	       				<option id="${user.id}" value="${user.id}">
	       					<c:out value="${user.fi}"/>
	       				</option>
	       			</c:forEach>
	       		</select>
	   		</t:input>
		</form:form>
			<span class="link" onclick="select_all();" style="padding: 5px 15px;">Сохранить</span>
		<span class="link" onclick="history.back()">Назад</span>
	</div>
	<div>
	
	</div>
</t:body>